package com.heimdallr.rbac.user.service.impl;

import com.heimdallr.rbac.permission.entity.GroupEntity;
import com.heimdallr.rbac.permission.entity.UserEntity;
import com.heimdallr.rbac.user.dao.UserDao;
import com.heimdallr.rbac.user.service.UserService;
import com.heimdallr.util.RedisKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * @author user
 */
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	@Autowired
	private StringRedisTemplate redisTemplate;
	
	
	@Override
	public List<UserEntity> getUserList(Map<String,Object> paraMap){
		return userDao.getUserList(paraMap);
	}

	@Override
	public UserEntity getUserEntityByUserName(String userName){
		return userDao.getByUserName(userName);
	}

    @Override
    public List<GroupEntity> getAllUserGroup(){
        return userDao.getAllUserGroups();
    }

    @Override
    public boolean editUserGroup(String userId,String groupId){

        int count = userDao.uptUserGroup(userId,Integer.parseInt(groupId));

        return count>0 ;

    }

    @Override
	public int updateUserEntity(String username, String nickname, String password){
		return userDao.updateUserEntity(username,nickname,password);
	}


}
